import axios from 'axios'

const axiosInstance = axios.create({
  baseURL: '',
  timeout: 5000,
  headers: {}
})

//请求拦截器
axiosInstance.interceptors.request.use((config: any) => {
  return config
}, (error) => {
  return Promise.reject(error)
});

//响应拦截器
axiosInstance.interceptors.response.use((response: any) => {
  const data = response.data
  return Promise.resolve(data)
}, (error) => {
  return Promise.reject(error)
})

export default axiosInstance